Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemVerilog stubs generation #45

Merged
merged 8 commits into from
Aug 8, 2024
Merged

SystemVerilog stubs generation #45

merged 8 commits into from
Aug 8, 2024

Conversation

Muxianesty
Copy link
Collaborator

This Pull Request introduces a new option for Utopia HLS CLI to generate stub modules for SystemVerilog, which can be useful in SystemVerilog syntax parsing (e.g. with Verilator).

@Muxianesty Muxianesty added the stage II For issues applicable to Stage II of the project label Aug 8, 2024
@Muxianesty Muxianesty self-assigned this Aug 8, 2024
@Muxianesty Muxianesty requested a review from ssmolov August 8, 2024 11:27
@Muxianesty
Copy link
Collaborator Author

Muxianesty commented Aug 8, 2024

The next commit should fix the existing CI to build install CTemplate as well.

README.md Outdated
@@ -217,6 +218,7 @@ The list of arguments for `hls`-mode is presented below:
* `-h,--help`: *optional* flag; used to print the help-message about other arguments.
* `--config <PATH>`: *required* filesystem-path option; used to specify the file for a JSON latency configuration file. Its format is presented in *JSON Configuration* section.
* `--out-sv <PATH>`: *optional* filesystem-path option; used to specify the output SystemVerilog file.
* `--out-sv-stubs <PATH>`: *optional* filesystem-path option; used to specify the output file for generated SystemVerilog stubs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out-sv-stubs -> out-sv-lib

"the output file for generated SystemVerilog stubs" -> "the output SystemVerilog file for generated operations library"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

config.json Outdated
@@ -4,6 +4,7 @@
"asap_scheduler" : false,
"lp_scheduler" : false,
"out_sv" : "",
"out_sv_stubs" : "",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renaming

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -37,4 +37,18 @@ def DFCIRLinearSchedulerPass: Pass<"dfcir-linear-scheduler-pass", "mlir::ModuleO
let constructor = "mlir::dfcir::createDFCIRLinearSchedulerPass()";
}

def FIRRTLStubGeneratorPass: Pass<"firrtl-stub-generator-pass", "mlir::ModuleOp"> {
let summary = "Generate stubs for pipelined computational modules, specified in FIRRTL.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Generate stubs for pipelined computational modules, specified in FIRRTL." -> ""Generate stub modules for pipelined computational operations.""

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

//
// Part of the Utopia HLS Project, under the Apache License v2.0
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021-2024 ISP RAS (http://www.ispras.ru)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021-2024 -> 2024

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed here and in templates/stubs.tpl.

Comment on lines 60 to 62
} else {
result->SetValue("OP", "*");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add separate branch for MUL operation, report an error ("Unsupported module: " ?) at the default branch

@@ -62,6 +62,7 @@ enum Scheduler {
// Used for accessing specified output format paths.
enum class OutputFormatID : uint8_t {
SystemVerilog = 0,
SVStubs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably renaming?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

src/options.h Outdated
@@ -36,6 +36,7 @@
#define ASAP_SCHEDULER_JSON "asap_scheduler"
#define LP_SCHEDULER_JSON "lp_scheduler"
#define OUT_SV_JSON "out_sv"
#define OUT_SV_STUBS_JSON "out_sv_stubs"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename

src/options.h Outdated
@@ -49,6 +50,7 @@
#define LP_SCHEDULER_FLAG CLI_FLAG("l")
#define OUTPUT_GROUP "output"
#define OUT_SV_ARG CLI_ARG("out-sv")
#define OUT_SV_STUBS_ARG CLI_ARG("out-sv-stubs")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename

src/options.h Outdated
Comment on lines 189 to 191
outputGroup->add_option(OUT_SV_STUBS_ARG,
outNames[OUT_FORMAT_ID_INT(SVStubs)],
"Path to output stubs for SystemVerilog modules");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename

src/options.h Outdated
@@ -198,6 +203,7 @@ struct HlsOptions final : public AppOptions {
get(json, ASAP_SCHEDULER_JSON, asapScheduler);
get(json, LP_SCHEDULER_JSON, lpScheduler);
get(json, OUT_SV_JSON, outNames[OUT_FORMAT_ID_INT(SystemVerilog)]);
get(json, OUT_SV_STUBS_JSON, outNames[OUT_FORMAT_ID_INT(SVStubs)]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename

Copy link
Collaborator Author

@Muxianesty Muxianesty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed according to comments.

Copy link
Collaborator

@ssmolov ssmolov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

@ssmolov ssmolov merged commit 768cca0 into master Aug 8, 2024
2 checks passed
@Muxianesty Muxianesty deleted the gen_stubs branch August 15, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage II For issues applicable to Stage II of the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants